#!/usr/bin/env python

from samba_utils import *
import samba_version, samba3

TDB_LIB_SRC = '''
	  lib/dbwrap/dbwrap_open.c
          lib/dbwrap/dbwrap_ctdb.c
          lib/dbwrap/dbwrap_watch.c
          lib/g_lock.c'''

TDB_VALIDATE_SRC = '''lib/tdb_validate.c'''

SMBLDAP_SRC = '''lib/smbldap.c'''

VERSION_SRC = '''lib/version.c'''

AFS_SRC = 'lib/afs.c'

AFS_SETTOKEN_SRC = 'lib/afs_settoken.c'

AVAHI_SRC = 'lib/avahi.c smbd/avahi_register.c'

SERVER_MUTEX_SRC = 'lib/server_mutex.c'

PASSCHANGE_SRC = '''libsmb/passchange.c'''

LIBCLI_SPOOLSS_SRC = '''rpc_client/cli_spoolss.c
                     rpc_client/init_spoolss.c'''

LIBCLI_LSA_SRC = '''rpc_client/cli_lsarpc.c'''

LIBCLI_SAMR_SRC = 'rpc_client/cli_samr.c'

LIBCLI_NETLOGON_SRC = 'rpc_client/cli_netlogon.c rpc_client/util_netlogon.c'

# this includes only the low level parse code, not stuff
# that requires knowledge of security contexts
REG_PARSE_PRS_SRC = '''registry/reg_parse_prs.c'''

LIB_SRC = '''
          lib/messages.c lib/messages_local.c
          lib/messages_ctdbd.c lib/ctdb_packet.c lib/ctdbd_conn.c
	  lib/ctdb_conn.c
	  lib/msg_channel.c
          lib/id_cache.c
          lib/talloc_dict.c
          lib/serverid.c
          lib/addrchange.c
          ${TDB_LIB_SRC}
          ../lib/util/debug_s3.c
          lib/dumpcore.c
          lib/interface.c
          lib/username.c
          lib/access.c lib/smbrun.c
          lib/wins_srv.c
          lib/substitute.c lib/substitute_generic.c
          lib/ms_fnmatch.c
          lib/tallocmsg.c lib/dmallocmsg.c
          intl/lang_tdb.c
          lib/gencache.c
          lib/events.c
          lib/server_contexts.c
          lib/server_prefork.c
          lib/server_prefork_util.c
          lib/ldap_escape.c
          lib/fncall.c
          libads/krb5_errs.c lib/system_smbd.c lib/audit.c
	  lib/tevent_wait.c
	  lib/smbd_tevent_queue.c
          lib/idmap_cache.c'''

LIB_UTIL_SRC = '''
               lib/system.c
               lib/sendfile.c
               lib/recvfile.c
               lib/time.c
               lib/util_sid.c
               lib/util_file.c
               lib/util.c
               lib/util_sock.c
               lib/util_transfer_file.c
               lib/sock_exec.c'''

POPT_LIB_SRC = '''lib/popt_common.c'''

PARAM_UTIL_SRC = '''param/util.c'''

PARAM_WITHOUT_REG_SRC = '''param/loadparm.c
                           lib/sharesec.c lib/ldap_debug_handler.c lib/util_names.c'''

KRBCLIENT_SRC = '''libads/kerberos.c libads/ads_status.c'''

LIBGPO_SRC0 = '''../libgpo/gpo_ldap.c ../libgpo/gpo_ini.c ../libgpo/gpo_util.c
              ../libgpo/gpo_fetch.c libgpo/gpo_filesync.c ../libgpo/gpo_sec.c
              libgpo/gpo_reg.c'''
LIBGPO_SRC = '''${LIBGPO_SRC0}'''

LIBADS_SRC = '''libads/ldap.c
             libads/sasl.c libads/sasl_wrapping.c
             libads/krb5_setpw.c
             libads/kerberos_util.c
             libads/ldap_user.c
             libads/ads_struct.c libads/kerberos_keytab.c
             libads/disp_sec.c libads/ldap_utils.c
             libads/ldap_schema.c libads/util.c libads/ndr.c'''

LIBADS_SERVER_SRC = '''libads/authdata.c'''

LIBADS_PRINTER_SRC = '''libads/ldap_printer.c'''

SECRETS_SRC = '''passdb/secrets.c passdb/machine_account_secrets.c
                 passdb/machine_sid.c passdb/secrets_lsa.c'''

LIBNMB_SRC = '''libsmb/unexpected.c libsmb/namecache.c libsmb/nmblib.c
             libsmb/namequery.c libsmb/conncache.c

             libads/sitename_cache.c'''

LIBNTLMSSP_SRC = '''
               libsmb/ntlmssp.c
               libsmb/ntlmssp_wrap.c'''

TLDAP_SRC = '''lib/tldap.c lib/tldap_util.c lib/util_tsock.c'''

LIBSMB_SRC = '''libsmb/clientgen.c libsmb/cliconnect.c libsmb/clifile.c
             libsmb/clispnego.c
             libsmb/clirap.c libsmb/clierror.c libsmb/climessage.c
             libsmb/clireadwrite.c libsmb/clilist.c libsmb/cliprint.c
             libsmb/clitrans.c libsmb/clisecdesc.c libsmb/clidgram.c
             libsmb/clistr.c libsmb/cliquota.c libsmb/clifsinfo.c libsmb/clidfs.c
             libsmb/clioplock.c libsmb/clirap2.c
             libsmb/async_smb.c
             libsmb/smb2cli_tcon.c
             libsmb/cli_np_tstream.c
             libsmb/reparse_symlink.c
             libsmb/clisymlink.c
             libsmb/smbsock_connect.c'''

LIBMSRPC_SRC = '''
               rpc_client/cli_pipe.c
               librpc/rpc/rpc_common.c
               rpc_client/rpc_transport_np.c
               rpc_client/rpc_transport_sock.c
               rpc_client/rpc_transport_tstream.c
               librpc/rpc/dcerpc_helpers.c
               '''

#
# registry-related objects
#

REG_INIT_SMBCONF_SRC = '''registry/reg_init_smbconf.c'''
REG_INIT_FULL_SRC = '''registry/reg_init_full.c'''

REGFIO_SRC = '''registry/regfio.c ${REG_PARSE_PRS_SRC}'''

REG_API_REGF_SRC = '''registry/reg_api_regf.c'''

REG_BACKENDS_SMBCONF_SRC = '''registry/reg_backend_smbconf.c'''

REG_BACKENDS_EXTRA_SRC = '''registry/reg_backend_printing.c
                         registry/reg_backend_shares.c
                         registry/reg_backend_netlogon_params.c
                         registry/reg_backend_prod_options.c
                         registry/reg_backend_tcpip_params.c
                         registry/reg_backend_hkpt_params.c
                         registry/reg_backend_current_version.c
                         registry/reg_backend_perflib.c'''

REG_BASE_SRC = '''registry/reg_api.c
               registry/reg_dispatcher.c
               registry/reg_cachehook.c
               registry/reg_objects.c
               registry/reg_util_internal.c
               lib/util_nttoken.c
               registry/reg_backend_db.c
               registry/reg_parse_internal.c
               lib/cbuf.c
               lib/srprs.c
               registry/reg_init_basic.c'''

REG_SMBCONF_SRC = '''
                  ${REG_BACKENDS_SMBCONF_SRC}
                  ${REG_INIT_SMBCONF_SRC}
                  registry/reg_util_token.c
                  registry/reg_api_util.c'''

REG_FULL_SRC = '''
               ${REG_BACKENDS_EXTRA_SRC}
               ${REG_INIT_FULL_SRC}
               registry/reg_perfcount.c'''

SERVICES_SRC = '''services/svc_spoolss.c
                  services/svc_rcinit.c
                  services/svc_winreg_glue.c
                  services/svc_netlogon.c
                  services/svc_winreg.c
                  services/svc_wins.c'''

LIB_EVENTLOG_SRC = '''lib/eventlog/eventlog.c'''

RPC_CLIENT_SCHANNEL_SRC = '''rpc_client/cli_pipe_schannel.c'''

LOCKING_SRC = '''locking/locking.c locking/brlock.c locking/posix.c locking/share_mode_lock.c'''

PRIVILEGES_SRC = '''lib/privileges.c'''

PASSDB_GET_SET_SRC = '''passdb/pdb_get_set.c'''

PASSDB_SRC = '''${PASSDB_GET_SET_SRC} passdb/passdb.c
                lib/util_wellknown.c lib/util_builtin.c passdb/pdb_compat.c
                lib/util_sid_passdb.c
                lib/util_unixsids.c passdb/lookup_sid.c
                passdb/login_cache.c
                passdb/account_pol.c ${PRIVILEGES_SRC}
                lib/util_nscd.c lib/winbind_util.c
                passdb/pdb_util.c passdb/pdb_interface.c
                passdb/pdb_secrets.c
                passdb/pdb_unixid.c'''
#FIXME: lib/winbind_util.c probably is not part of PASSDB_SRC

GROUPDB_SRC = '''groupdb/mapping.c groupdb/mapping_tdb.c'''

PROFILE_SRC = '''profile/profile.c'''
PROFILES_SRC = '''utils/profiles.c'''

OPLOCK_SRC = '''smbd/oplock.c smbd/oplock_irix.c smbd/oplock_linux.c'''

NOTIFY_SRC = '''smbd/notify.c smbd/notify_inotify.c smbd/notify_internal.c'''

FNAME_UTIL_SRC = '''lib/filename_util.c'''


PLAINTEXT_AUTH_SRC = '''auth/pampass.c auth/pass_check.c'''

SLCACHE_SRC = '''libsmb/samlogon_cache.c'''

DCUTIL_SRC  = '''libsmb/namequery_dc.c libsmb/trustdom_cache.c libsmb/dsgetdcname.c'''

WINBINDD_SRC1 = '''winbindd/winbindd.c
                   winbindd/winbindd_group.c
                   winbindd/winbindd_util.c
                   winbindd/winbindd_cache.c
                   winbindd/winbindd_pam.c
                   winbindd/winbindd_misc.c
                   winbindd/winbindd_cm.c
                   winbindd/winbindd_wins_byip.c
                   winbindd/winbindd_wins_byname.c
                   winbindd/winbindd_msrpc.c
                   winbindd/winbindd_rpc.c
                   winbindd/winbindd_reconnect.c
                   winbindd/winbindd_ads.c
                   winbindd/winbindd_samr.c
                   winbindd/winbindd_dual.c
                   winbindd/winbindd_dual_ndr.c
                   winbindd/winbindd_dual_srv.c
                   winbindd/winbindd_async.c
                   winbindd/winbindd_creds.c
                   winbindd/winbindd_cred_cache.c
                   winbindd/winbindd_ccache_access.c
                   winbindd/winbindd_domain.c
                   winbindd/winbindd_idmap.c
                   winbindd/winbindd_locator.c
                   winbindd/winbindd_ndr.c
                   winbindd/wb_ping.c
                   winbindd/wb_lookupsid.c
                   winbindd/wb_lookupsids.c
                   winbindd/wb_lookupname.c
                   winbindd/wb_uid2sid.c
                   winbindd/wb_gid2sid.c
                   winbindd/wb_sids2xids.c
                   winbindd/wb_queryuser.c
                   winbindd/wb_lookupuseraliases.c
                   winbindd/wb_lookupusergroups.c
                   winbindd/wb_getpwsid.c
                   winbindd/wb_gettoken.c
                   winbindd/wb_seqnum.c
                   winbindd/wb_seqnums.c
                   winbindd/wb_group_members.c
                   winbindd/wb_getgrsid.c
                   winbindd/wb_query_user_list.c
                   winbindd/wb_fill_pwent.c
                   winbindd/wb_next_pwent.c
                   winbindd/wb_next_grent.c
                   winbindd/wb_dsgetdcname.c
                   winbindd/winbindd_lookupsid.c
                   winbindd/winbindd_lookupsids.c
                   winbindd/winbindd_lookupname.c
                   winbindd/winbindd_sid_to_uid.c
                   winbindd/winbindd_sid_to_gid.c
                   winbindd/winbindd_uid_to_sid.c
                   winbindd/winbindd_gid_to_sid.c
                   winbindd/winbindd_sids_to_xids.c
                   winbindd/winbindd_allocate_uid.c
                   winbindd/winbindd_allocate_gid.c
                   winbindd/winbindd_getpwsid.c
                   winbindd/winbindd_getpwnam.c
                   winbindd/winbindd_getpwuid.c
                   winbindd/winbindd_getsidaliases.c
                   winbindd/winbindd_getuserdomgroups.c
                   winbindd/winbindd_getgroups.c
                   winbindd/winbindd_show_sequence.c
                   winbindd/winbindd_getgrgid.c
                   winbindd/winbindd_getgrnam.c
                   winbindd/winbindd_getusersids.c
                   winbindd/winbindd_lookuprids.c
                   winbindd/winbindd_setpwent.c
                   winbindd/winbindd_getpwent.c
                   winbindd/winbindd_endpwent.c
                   winbindd/winbindd_setgrent.c
                   winbindd/winbindd_getgrent.c
                   winbindd/winbindd_endgrent.c
                   winbindd/winbindd_dsgetdcname.c
                   winbindd/winbindd_getdcname.c
                   winbindd/winbindd_list_users.c
                   winbindd/winbindd_list_groups.c
                   winbindd/winbindd_check_machine_acct.c
                   winbindd/winbindd_change_machine_acct.c
                   winbindd/winbindd_ping_dc.c
                   winbindd/winbindd_pam_auth.c
                   winbindd/winbindd_pam_logoff.c
                   winbindd/winbindd_pam_chauthtok.c
                   winbindd/winbindd_pam_auth_crap.c
                   winbindd/winbindd_pam_chng_pswd_auth_crap.c'''

WINBINDD_SRC = '''${WINBINDD_SRC1}
                  ${TDB_VALIDATE_SRC}'''

MANGLE_SRC = '''smbd/mangle.c smbd/mangle_hash.c smbd/mangle_hash2.c'''

SMBD_SRC_MAIN = '''smbd/server.c'''

BUILDOPT_SRC = '''smbd/build_options.c'''

SMBD_SRC_SRV = '''smbd/server_reload.c smbd/files.c smbd/connection.c
               smbd/utmp.c smbd/session.c
               smbd/dfree.c smbd/dir.c smbd/password.c smbd/conn_msg.c
               smbd/conn_idle.c
               smbd/share_access.c smbd/fileio.c
               smbd/ipc.c smbd/lanman.c smbd/negprot.c
               smbd/message.c smbd/nttrans.c smbd/pipes.c
               smbd/reply.c smbd/sesssetup.c smbd/trans2.c smbd/uid.c
               smbd/dosmode.c smbd/filename.c smbd/open.c smbd/close.c
               smbd/blocking.c smbd/sec_ctx.c smbd/srvstr.c
               smbd/vfs.c smbd/perfcount.c smbd/statcache.c smbd/seal.c
               smbd/posix_acls.c lib/sysacls.c
               smbd/process.c smbd/service.c smbd/error.c
               printing/printspoolss.c printing/spoolssd.c
               lib/sysquotas.c lib/sysquotas_linux.c
               lib/sysquotas_xfs.c lib/sysquotas_4A.c lib/sysquotas_4B.c
               lib/sysquotas_nfs.c
               lib/background.c
               lib/sessionid_tdb.c
               lib/conn_tdb.c
               smbd/fake_file.c
               smbd/quotas.c smbd/ntquotas.c smbd/msdfs.c
               smbd/aio.c smbd/statvfs.c
               smbd/dmapi.c smbd/signing.c
               smbd/file_access.c
               smbd/dnsregister.c smbd/globals.c
               smbd/smb2_server.c
               smbd/smb2_glue.c
               smbd/smb2_negprot.c
               smbd/smb2_sesssetup.c
               smbd/smb2_tcon.c
               smbd/smb2_create.c
               smbd/smb2_close.c
               smbd/smb2_flush.c
               smbd/smb2_read.c
               smbd/smb2_write.c
               smbd/smb2_lock.c
               smbd/smb2_ioctl.c
               smbd/smb2_keepalive.c
               smbd/smb2_find.c
               smbd/smb2_notify.c
               smbd/smb2_getinfo.c
               smbd/smb2_setinfo.c
               smbd/smb2_break.c
               smbd/smbXsrv_version.c
               smbd/smbXsrv_session.c
               smbd/smbXsrv_tcon.c
               smbd/smbXsrv_open.c
               smbd/server_exit.c
               smbd/durable.c
               smbd/scavenger.c
               ${MANGLE_SRC}'''

SMBD_SRC_BASE = '''${SMBD_SRC_SRV}
                ${OPLOCK_SRC} ${NOTIFY_SRC}
                ${BUILDOPT_SRC}'''

PRINTING_SRC = '''printing/pcap.c printing/print_svid.c printing/print_aix.c
               printing/print_cups.c printing/print_generic.c
               printing/lpq_parse.c printing/load.c printing/print_standard.c
               printing/print_iprint.c printing/printer_list.c'''

PRINTBASE_SRC = '''printing/notify.c printing/printing_db.c'''
PRINTBACKEND_SRC = '''printing/printing.c
                      printing/nt_printing.c
                      printing/nt_printing_tdb.c
                      printing/nt_printing_migrate_internal.c
                      printing/nt_printing_ads.c
                      printing/queue_process.c'''

NMBD_SRC1 = '''nmbd/asyncdns.c nmbd/nmbd.c nmbd/nmbd_become_dmb.c
            nmbd/nmbd_become_lmb.c nmbd/nmbd_browserdb.c
            nmbd/nmbd_browsesync.c nmbd/nmbd_elections.c
            nmbd/nmbd_incomingdgrams.c nmbd/nmbd_incomingrequests.c
            nmbd/nmbd_lmhosts.c nmbd/nmbd_logonnames.c nmbd/nmbd_mynames.c
            nmbd/nmbd_namelistdb.c nmbd/nmbd_namequery.c
            nmbd/nmbd_nameregister.c nmbd/nmbd_namerelease.c
            nmbd/nmbd_nodestatus.c nmbd/nmbd_packets.c
            nmbd/nmbd_processlogon.c nmbd/nmbd_responserecordsdb.c
            nmbd/nmbd_sendannounce.c nmbd/nmbd_serverlistdb.c
            nmbd/nmbd_subnetdb.c nmbd/nmbd_winsproxy.c nmbd/nmbd_winsserver.c
            nmbd/nmbd_workgroupdb.c nmbd/nmbd_synclists.c'''

NMBD_SRC = '${NMBD_SRC1}'

SWAT_SRC1 = '''web/cgi.c web/diagnose.c web/startstop.c web/statuspage.c
               web/swat.c web/neg_lang.c'''

SWAT_SRC = '''${SWAT_SRC1}'''

STATUS_SRC = '''utils/status.c utils/status_profile.c smbd/notify_internal.c'''

SMBCONTROL_SRC = '''utils/smbcontrol.c'''

SMBTREE_SRC = '''utils/smbtree.c'''

TESTPARM_SRC = 'utils/testparm.c'

SMBTA_UTIL_SRC = '''utils/smbta-util.c'''

TEST_LP_LOAD_SRC = '''param/test_lp_load.c'''

PASSWD_UTIL_SRC = 'utils/passwd_util.c'

SMBPASSWD_SRC = '''utils/smbpasswd.c'''

PDBEDIT_SRC = '''utils/pdbedit.c'''

SMBGET_SRC = '''utils/smbget.c'''

RPCCLIENT_SRC1 = '''rpcclient/rpcclient.c rpcclient/cmd_lsarpc.c
                    rpcclient/cmd_samr.c rpcclient/cmd_spoolss.c
                    rpcclient/cmd_netlogon.c rpcclient/cmd_srvsvc.c
                    rpcclient/cmd_dfs.c rpcclient/cmd_epmapper.c
                    rpcclient/cmd_dssetup.c rpcclient/cmd_echo.c
                    rpcclient/cmd_shutdown.c rpcclient/cmd_test.c
                    rpcclient/cmd_wkssvc.c rpcclient/cmd_ntsvcs.c
                    rpcclient/cmd_drsuapi.c rpcclient/cmd_eventlog.c
                    rpcclient/cmd_winreg.c rpcclient/cmd_fss.c'''

RPCCLIENT_SRC = '''${RPCCLIENT_SRC1}'''

LIBSMBCLIENT_THREAD_SRC = '''libsmb/libsmb_thread_impl.c
                        libsmb/libsmb_thread_posix.c'''

LIBSMBSHAREMODES_SRC0 = 'libsmb/smb_share_modes.c'

LIBSMBSHAREMODES_SRC = '${LIBSMBSHAREMODES_SRC0}'

LIBNETAPI_SRC0 = '''lib/netapi/netapi.c
                    lib/netapi/cm.c
                    lib/netapi/libnetapi.c
                    lib/netapi/joindomain.c
                    lib/netapi/serverinfo.c
                    lib/netapi/getdc.c
                    lib/netapi/user.c
                    lib/netapi/group.c
                    lib/netapi/localgroup.c
                    lib/netapi/samr.c
                    lib/netapi/sid.c
                    lib/netapi/share.c
                    lib/netapi/file.c
                    lib/netapi/shutdown.c
                    lib/netapi/netlogon.c'''

LIBNETAPI_SRC = '''${LIBNETAPI_SRC0}'''

CLIENT_SRC = '''
             client/client.c
             client/clitar.c
             client/dnsbrowse.c'''

LIB_SMBCONF_SRC = 'lib/smbconf/smbconf_init.c lib/smbconf/smbconf_reg.c'

SMBCONFTORT_SRC0 = 'lib/smbconf/testsuite.c'

SMBCONFTORT_SRC = '''${SMBCONFTORT_SRC0}'''

LIBNET_SRC = 'libnet/libnet_join.c'


LIBNET_DSSYNC_SRC = '''libnet/libnet_dssync.c
                       libnet/libnet_dssync_passdb.c
                       libnet/libnet_dssync_keytab.c'''

LIBNET_SAMSYNC_SRC = '''libnet/libnet_samsync.c
                        libnet/libnet_samsync_ldif.c
                        libnet/libnet_samsync_passdb.c
                        libnet/libnet_samsync_display.c
                        libnet/libnet_samsync_keytab.c'''

NET_SRC1 = '''utils/net.c utils/net_ads.c utils/net_help.c
              utils/net_rap.c utils/net_rpc.c utils/net_rpc_samsync.c
              utils/net_rpc_join.c utils/net_time.c utils/net_lookup.c
              utils/net_cache.c utils/net_groupmap.c
              utils/net_idmap.c utils/net_idmap_check.c
              utils/interact.c
              utils/net_status.c utils/net_rpc_printer.c utils/net_rpc_rights.c
              utils/net_rpc_service.c utils/net_rpc_registry.c utils/net_usershare.c
              utils/netlookup.c utils/net_sam.c utils/net_rpc_shell.c
              utils/net_util.c utils/net_rpc_sh_acct.c utils/net_rpc_audit.c
              utils/net_dns.c utils/net_ads_gpo.c
              utils/net_conf.c utils/net_join.c utils/net_user.c
              utils/net_group.c utils/net_file.c utils/net_registry.c
              utils/net_registry_check.c
              utils/net_dom.c utils/net_share.c
              utils/net_g_lock.c
              utils/net_serverid.c
              utils/net_eventlog.c
              utils/net_printing.c
              utils/net_rpc_trust.c
              utils/net_rpc_conf.c
              registry/reg_parse.c registry/reg_format.c
              registry/reg_import.c
              '''

NET_SRC2 = 'utils/net_registry_util.c utils/net_help_common.c'

NET_SRC = '''${NET_SRC1}
             ${NET_SRC2}'''

CUPS_SRC = '''client/smbspool.c'''

NMBLOOKUP_SRC = '''utils/nmblookup.c'''

SMBTORTURE_SRC1 = '''torture/torture.c torture/nbio.c torture/scanner.c torture/utable.c
                torture/denytest.c torture/mangle_test.c
                torture/nbench.c
                torture/test_async_echo.c
                torture/test_addrchange.c
                torture/test_posix_append.c
                torture/test_nttrans_create.c
                torture/test_nttrans_fsctl.c
                torture/test_case_insensitive.c
                torture/test_notify_online.c
                torture/test_chain3.c
                torture/test_smb2.c
                torture/test_authinfo_structs.c
                torture/test_smbsock_any_connect.c
                torture/test_cleanup.c
                torture/test_ctdbconn.c
                torture/test_msg.c
                torture/test_notify.c
                lib/tevent_barrier.c
                torture/test_dbwrap_watch.c
                torture/test_idmap_tdb_common.c
                torture/t_strappend.c'''

SMBTORTURE_SRC = '''${SMBTORTURE_SRC1}
        torture/wbc_async.c'''

MSGTEST_SRC = '''torture/msgtest.c'''

PDBTEST_SRC = '''torture/pdbtest.c'''

VFSTEST_SRC = '''torture/cmd_vfs.c torture/vfstest.c
		torture/vfstest_chain.c'''

LOG2PCAP_SRC = '''utils/log2pcaphex.c'''

LOCKTEST2_SRC = '''torture/locktest2.c'''

SMBCACLS_SRC = '''utils/smbcacls.c'''

SMBCQUOTAS_SRC = '''utils/smbcquotas.c'''

EVTLOGADM_SRC0 = 'utils/eventlogadm.c'

EVTLOGADM_SRC = '''${EVTLOGADM_SRC0}'''

SHARESEC_SRC0 = 'utils/sharesec.c'
SHARESEC_SRC  = '''${SHARESEC_SRC0}'''

DEBUG2HTML_SRC = '''utils/debug2html.c utils/debugparse.c'''

SMBFILTER_SRC = '''utils/smbfilter.c'''

WINBIND_WINS_NSS_SRC = '''../nsswitch/wins.c'''

NTLM_AUTH_SRC1 = '''utils/ntlm_auth.c utils/ntlm_auth_diagnostics.c'''

NTLM_AUTH_SRC = '''${NTLM_AUTH_SRC1}'''

VLP_SRC = '''printing/tests/vlp.c'''

RPC_OPEN_TCP_SRC = 'torture/rpc_open_tcp.c'

DBWRAP_TOOL_SRC = 'utils/dbwrap_tool.c'

DBWRAP_TORTURE_SRC = 'utils/dbwrap_torture.c'

SPLIT_TOKENS_SRC = 'utils/split_tokens.c'

LIBS='ICONV'

config_h = "../include/config.h"

bld.SAMBA_BLDOPTIONS('smbd/build_options.c')

t = bld.SAMBA_GENERATOR('build_env.h',
                        source='script/build_env.sh',
                        target='include/build_env.h',
                        rule='${SRC} ${SRCDIR} ${BUILDDIR} ${CC} > ${TGT}')
# todo: work out what is really wanted here
t.env.SRCDIR = bld.path.abspath()
t.env.BUILDDIR = bld.path.abspath()

bld.SETUP_BUILD_GROUPS()

######################## SUBSYSTEMS #################################

bld.SAMBA3_LIBRARY('netapi',
                    source=LIBNETAPI_SRC,
                    public_deps='''
                    talloc
                    util_cmdline
                    msrpc3
                    ads
                    NDR_LIBNETAPI
                    LIBNET
                    RPC_CLIENT_SCHANNEL
                    libcli_netlogon3
                    LIBCLI_SAMR
                    INIT_SAMR
                    auth
                    ''',
                    public_headers='../source3/lib/netapi/netapi.h',
                    pc_files='libnet/netapi.pc',
                    vnum='0',
                    vars=locals())

bld.SAMBA3_LIBRARY('smbsharemodes',
                    source=LIBSMBSHAREMODES_SRC,
                    public_deps='''talloc tdb_compat''',
                    deps='''ccan-hash''',
                    public_headers='include/smb_share_modes.h',
                    pc_files='libsmb/smbsharemodes.pc',
                    vnum='0',
                    vars=locals())

bld.SAMBA3_LIBRARY('gse',
                   source='librpc/crypto/gse_krb5.c librpc/crypto/gse.c',
                   deps='krb5samba gensec param KRBCLIENT secrets3',
                   private_library=True)

bld.SAMBA3_LIBRARY('msrpc3',
                   source='${LIBMSRPC_SRC}',
                   deps='''ndr ndr-standard
                    RPC_NDR_EPMAPPER NTLMSSP_COMMON COMMON_SCHANNEL LIBCLI_AUTH
                    LIBTSOCKET gse dcerpc-binding
                    libsmb''',
                   vars=locals(),
                   private_library=True)

bld.SAMBA3_LIBRARY('gpo',
                   source='${LIBGPO_SRC}',
                   deps='talloc ads TOKEN_UTIL gpext auth',
                   vars=locals(),
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('AVAHI',
                    source=AVAHI_SRC,
                    deps='avahi-common avahi-client',
                    enabled=bld.env.with_avahi)

bld.SAMBA3_SUBSYSTEM('GROUPDB',
                    source=GROUPDB_SRC,
                    deps='tdb_compat')

bld.SAMBA3_SUBSYSTEM('TLDAP',
                    source=TLDAP_SRC,
                    deps='asn1util LIBTSOCKET')

# libpdb.so should not expose internal symbols that are only usable
# to the statically linked modules that are merged into libpdb.
# Note that we always filter these symbols out in libpdb, even
# when modules are not linked statically. In the latter case
# symbols will not be present in the libpdb anyway so no hurt is
# done to the version script.
static_pdb_match = ['tdbsam', 'smbpasswd', 'wbc_sam']
private_pdb_match = []

# AD DC module when linked statically will pull in few source4/winbind
# dependencies which are not used outside AD DC module
static_pdb_match.append('samba_dsdb')
private_pdb_match.append('!idmap_init')
private_pdb_match.append('!idmap_sids_to_xids')
private_pdb_match.append('!idmap_xids_to_sids')

# ldap module is actually three modules merged together: ldapsam, ipa, and nds
static_pdb_match = static_pdb_match + ['ldap', 'ipa', 'nds']
ldapsam_pdb_match = ['!priv2ld', '!smbldap_search_domain_info',
                     '!ldapsam_*', '!groupmap_attr_list*', '!get_userattr_list',
                     '!dominfo_attr_list', '!get_attr_key2string',
                     '!sidmap_attr_list', '!attrib_map_*', '!idpool_attr_list',
                     '!get_attr_list']
private_pdb_match.append('!pdb_nds_*')
private_pdb_match.append('!pdb_init_ldapsam')
private_pdb_match.append('!pdb_ldapsam_init*')
private_pdb_match = private_pdb_match + ldapsam_pdb_match

private_pdb_match = private_pdb_match + map(lambda x: '!pdb_%s_init' % x, static_pdb_match)

bld.SAMBA3_LIBRARY('pdb',
                   source=PASSDB_SRC,
                   deps='secrets3 GROUPDB SERVER_MUTEX wbclient LIBCLI_AUTH flag_mapping',
                   private_library=False,
                   pc_files=[],
                   public_headers_install=True,
                   public_headers='''
				include/passdb.h
				passdb/machine_sid.h
				passdb/lookup_sid.h''',
                   abi_match=private_pdb_match,
                   abi_directory='passdb/ABI',
                   vnum='0',
                   vars=locals())

bld.SAMBA3_LIBRARY('smbldaphelper',
                   source='passdb/pdb_ldap_schema.c passdb/pdb_ldap_util.c',
                   deps='smbldap secrets3',
                   allow_undefined_symbols=True,
                   enabled=bld.CONFIG_SET('HAVE_LDAP'),
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('SERVER_MUTEX',
                     source=SERVER_MUTEX_SRC,
		     deps='talloc')

bld.SAMBA3_SUBSYSTEM('PARAM_UTIL',
                    source=PARAM_UTIL_SRC,
		    deps='talloc')

bld.SAMBA3_SUBSYSTEM('LOADPARM_CTX',
                     source='param/loadparm_ctx.c',
                     deps='''talloc s3_param_h param''',
                     vars=locals())

bld.SAMBA_GENERATOR('param/param_global_h',
                    source= '../script/mkparamdefs.pl param/loadparm.c ../lib/param/param_functions.c',
                    target='param/param_global.h',
                    rule='${PERL} ${SRC[0].abspath(env)} ${SRC[1].abspath(env)} ${SRC[2].abspath(env)} --file ${TGT} --generate-scope=GLOBAL')

bld.SAMBA3_SUBSYSTEM('param',
                   source=PARAM_WITHOUT_REG_SRC,
                   deps='samba-util PARAM_UTIL ldap lber LOADPARM_CTX samba3core smbconf param_local_h param/param_global_h cups''')

bld.SAMBA3_PYTHON('pys3param',
                  source='param/pyparam.c',
                  deps='param',
                  public_deps='samba-hostconfig pytalloc-util talloc',
                  realname='samba/samba3/param.so')
    
bld.SAMBA3_SUBSYSTEM('param_service',
                     source='param/service.c',
                     deps = 'USER_UTIL param PRINTING')

bld.SAMBA3_SUBSYSTEM('REGFIO',
                    source=REGFIO_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('REG_API_REGF',
                    source=REG_API_REGF_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_LIBRARY('smbregistry',
                   source=REG_BASE_SRC,
                   deps='''smbd_shim tdb-wrap3 NDR_SECURITY util_tdb talloc
                   replace util_reg samba-util samba-security
                   errors3 dbwrap samba3-util''',
                   allow_undefined_symbols=True,
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('REG_SMBCONF',
                    source=REG_SMBCONF_SRC,
                    deps='smbregistry',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('REG_FULL',
                    source=REG_FULL_SRC,
                    deps='REG_SMBCONF tdb-wrap3',
                    vars=locals())

bld.SAMBA3_LIBRARY('popt_samba3',
                   source=POPT_LIB_SRC,
                   deps='popt samba-util util_cmdline',
                   vars=locals(),
                   private_library=True)

bld.SAMBA3_LIBRARY('util_cmdline',
                   source='lib/util_cmdline.c',
                   deps='secrets3',
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('KRBCLIENT',
                    source=KRBCLIENT_SRC,
                    public_deps='krb5samba k5crypto gssapi LIBTSOCKET CLDAP LIBNMB',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('samba3util',
                   source=LIB_UTIL_SRC,
                   deps='ndr samba-security NDR_SECURITY samba-util util_tdb ccan-hash',
                   vars=locals())

bld.SAMBA3_SUBSYSTEM('samba3core',
                   source=LIB_SRC,
                   deps='''
                        samba3util
                        LIBTSOCKET
                        NDR_MESSAGING
                        LIBASYNC_REQ
                        UTIL_PW
                        SAMBA_VERSION
                        PTHREADPOOL
                        interfaces
                        param
                        dbwrap
                        samba3-util
                        errors3''',
                   vars=locals())

bld.SAMBA3_LIBRARY('smbd_shim',
                   source='''lib/smbd_shim.c''',
		   deps='talloc',
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('LIBNTLMSSP',
                    source=LIBNTLMSSP_SRC,
                    deps='NDR_NTLMSSP NTLMSSP_COMMON wbclient',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('auth_generic',
                    source='libsmb/auth_generic.c',
                    deps='LIBNTLMSSP gse gensec',
                    vars=locals())

bld.SAMBA3_LIBRARY('libsmb',
                   source=LIBSMB_SRC,
                   deps='''
                   LIBNTLMSSP
                   auth_generic
                   CLDAP
                   LIBNMB
                   SPNEGO_PARSE
                   LIBTSOCKET
                   KRBCLIENT
                   cli_smb_common
                   util_cmdline
                   tevent''',
                   vars=locals(),
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('CLDAP',
                    source='libads/cldap.c',
                    deps='cli-ldap-common cli_cldap LIBTSOCKET',
                    vars=locals())

# NOTE: The secrets3 library is a low level library used by several subsystems.
# PLEASE DO NOT make it depend on high level libraries like PDB, if you are
# doing that your design is wrong and needs changing. -SSS
bld.SAMBA3_LIBRARY('secrets3',
                   source=SECRETS_SRC,
                   deps='NDR_SECRETS param samba3util dbwrap',
                   private_library=True,
                   vars=locals())

bld.SAMBA3_LIBRARY('smbldap',
                    source=SMBLDAP_SRC,
                    deps='ldap lber samba-util param',
                    vars=locals(),
                    enabled=bld.CONFIG_SET("HAVE_LDAP"),
                    private_library=False,
                    abi_directory='lib/ABI',
                    abi_match='smbldap_*',
                    pc_files=[],
                    vnum='0',
                    public_headers='include/smbldap.h include/smb_ldap.h')

bld.SAMBA3_LIBRARY('ads',
                   source=LIBADS_SRC,
                   deps='cli-ldap-common krb5samba ldap lber KRBCLIENT param LIBNMB libsmb DCUTIL smbldap',
                   private_library=True,
                   vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBADS_SERVER',
                    source=LIBADS_SERVER_SRC,
                    deps='SERVER_MUTEX ndr-krb5pac krb5samba gssapi',
		    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBADS_PRINTER',
                    source=LIBADS_PRINTER_SRC,
                    deps='samba-util krb5samba',
		    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBAFS',
                    source=AFS_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBAFS_SETTOKEN',
                    source=AFS_SETTOKEN_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_LIBRARY('smbconf',
                   source=LIB_SMBCONF_SRC,
                   deps='''
                   CHARSET3
                   LIBSMBCONF
                   REG_SMBCONF
                   SAMBA_VERSION
                   cap
                   charset
                   cli_smb_common
                   errors3
                   param
                   samba-util
                   smbregistry
                   talloc
                   util_reg''',
                   public_headers='../lib/smbconf/smbconf.h',
                   pc_files=[],
                   vnum='0')

bld.SAMBA3_LIBRARY('smbd_conn',
                   source='smbd/conn.c',
                   deps='samba3-util samba-util',
                   private_library=True)

bld.SAMBA3_LIBRARY('smbd_base',
                    source=SMBD_SRC_BASE,
                    deps='''
                    talloc
                    tevent
                    pdb
                    libsmb
                    msrpc3
                    vfs
                    vfs_default
                    vfs_posixacl
                    popt_samba3
                    samba3core
                    smbd_conn
                    param_service
                    AVAHI
                    PRINTBASE
                    PROFILE
                    LOCKING
                    LIBADS_SERVER
                    LIBAFS
                    LIBAFS_SETTOKEN
                    RPC_SERVER
                    NDR_SMBXSRV
		    LIBASYS
                    ccan-hash
                    NDR_SMB_ACL
                    netapi
                    ''' + bld.env['dmapi_lib'],
                    private_library=True,
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LOCKING',
                    source='${LOCKING_SRC}',
                    deps='''
                    tdb_compat
                    talloc
                    NDR_OPEN_FILES
                    FNAME_UTIL''',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PROFILE',
                    source='${PROFILE_SRC}',
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PRINTBASE',
                    source=PRINTBASE_SRC,
                    deps='samba-util tdb_compat',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PRINTBACKEND',
                    source=PRINTBACKEND_SRC,
                    deps='PRINTBASE LIBADS_PRINTER tdb_compat printing_migrate',
                    vars=locals())

bld.SAMBA3_LIBRARY('printing_migrate',
                    source='printing/nt_printing_migrate.c rpc_client/cli_winreg_spoolss.c printing/nt_printing_os2.c',
                    deps='NDR_NTPRINTING cli_spoolss RPC_NDR_WINREG LIBCLI_WINREG param',
                    vars=locals(),
                    private_library=True)

bld.SAMBA3_SUBSYSTEM('PRINTING',
                    source=PRINTING_SRC,
                    deps='NDR_PRINTCAP tdb_compat cups',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PASSWD_UTIL',
                    source=PASSWD_UTIL_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('FNAME_UTIL',
                    source=FNAME_UTIL_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBNET',
                    source=LIBNET_SRC,
                    deps='NDR_LIBNET_JOIN INIT_SAMR net_keytab pdb',
                    vars=locals())

bld.SAMBA3_LIBRARY('net_keytab',
                   source='libnet/libnet_keytab.c',
                   deps='krb5samba ads',
                   vars=locals(),
                   private_library=True)


bld.SAMBA3_SUBSYSTEM('LIBNET_DSSYNC',
                    source=LIBNET_DSSYNC_SRC,
                    deps='LIBNET RPC_NDR_DRSUAPI',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBNET_SAMSYNC',
                    source=LIBNET_SAMSYNC_SRC,
                    deps='LIBNET LIBCLI_SAMSYNC',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBEVENTLOG',
                    source=LIB_EVENTLOG_SRC,
                    deps='NDR_EVENTLOG tdb_compat',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('LIBNMB',
                     source=LIBNMB_SRC,
                     deps='addns lmhosts resolv',
                     vars=locals())

bld.SAMBA3_SUBSYSTEM('SERVICES',
                    source=SERVICES_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PLAINTEXT_AUTH',
                    source=PLAINTEXT_AUTH_SRC,
                    deps='pam PAM_ERRORS',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('PASSCHANGE',
                    source=PASSCHANGE_SRC,
                    deps='''LIBCLI_SAMR
                    INIT_LSA
                    msrpc3
                    krb5samba''',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('SAMBA_VERSION',
                    source=VERSION_SRC,
                    deps='samba-util',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('SLCACHE',
                    source=SLCACHE_SRC,
                    deps='samba-util tdb_compat',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('DCUTIL',
                    source=DCUTIL_SRC,
                    deps='ads msrpc3 libcli_lsa3',
                    vars=locals())

bld.SAMBA3_LIBRARY('trusts_util',
                   source='libsmb/trusts_util.c',
                   deps='libcli_netlogon3 msrpc3 pdb',
                   vars=locals(),
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('tdb-wrap3',
                    source='lib/util_tdb.c',
                    deps='talloc samba3-util',
                    vars=locals())

bld.SAMBA3_LIBRARY('samba3-util',
                   source='''lib/util_sec.c lib/util_str.c lib/adt_tree.c lib/util_malloc.c lib/memcache.c lib/namearray.c lib/file_id.c''',
                   deps='samba-util charset',
                   private_library=True)

bld.SAMBA_LIBRARY('xattr_tdb',
                  source='lib/xattr_tdb.c',
                  deps='NDR_XATTR dbwrap samba3-util',
                  private_library=True)

bld.SAMBA3_LIBRARY('CHARSET3',
                    source='''lib/charcnv.c lib/fstring.c''',
                    public_deps='ICONV_WRAPPER charset',
                    deps='samba-util samba3-util',
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('errors3',
                     source='libsmb/errormap.c libsmb/smberr.c lib/errmap_unix.c',
                     deps='errors')

bld.SAMBA3_SUBSYSTEM('LIBCLI_SAMR',
                    source=LIBCLI_SAMR_SRC,
                    deps='RPC_NDR_SAMR')

bld.SAMBA3_LIBRARY('libcli_lsa3',
                   source=LIBCLI_LSA_SRC,
                   deps='RPC_NDR_LSA INIT_LSA',
                   private_library=True)

bld.SAMBA3_LIBRARY('libcli_netlogon3',
                   source=LIBCLI_NETLOGON_SRC,
                   deps='RPC_NDR_NETLOGON INIT_NETLOGON cliauth param',
                   private_library=True)

bld.SAMBA3_LIBRARY('cli_spoolss',
                   source=LIBCLI_SPOOLSS_SRC,
                   deps='RPC_NDR_SPOOLSS param secrets3',
                   private_library=True)

bld.SAMBA3_SUBSYSTEM('LIBCLI_WINREG',
                    source='rpc_client/cli_winreg.c',
                    deps='RPC_NDR_WINREG')

bld.SAMBA3_SUBSYSTEM('LIBCLI_WINREG_INTERNAL',
                    source='rpc_client/cli_winreg_int.c',
                    deps='LIBCLI_WINREG RPC_NCACN_NP')

bld.SAMBA3_SUBSYSTEM('RPC_CLIENT_SCHANNEL',
                    source=RPC_CLIENT_SCHANNEL_SRC,
                    deps='samba-util krb5samba',
                    vars=locals())

bld.SAMBA3_SUBSYSTEM('INIT_LSA',
                    source='rpc_client/init_lsa.c',
                    deps='samba-util')

bld.SAMBA3_SUBSYSTEM('INIT_NETLOGON',
                    source='rpc_client/init_netlogon.c',
                    deps='samba-util')

bld.SAMBA3_SUBSYSTEM('INIT_SAMR',
                    source='rpc_client/init_samr.c',
                    deps='samba-util')

bld.SAMBA3_SUBSYSTEM('LIBLSA',
                     source='lib/lsa.c')

########################## BINARIES #################################

bld.SAMBA3_BINARY('smbd/smbd',
                 source='${SMBD_SRC_MAIN}',
                 deps='smbd_base EPMD LSASD',
                 install_path='${SBINDIR}',
                 vars=locals())

bld.SAMBA3_BINARY('nmbd/nmbd',
                 source=NMBD_SRC,
                 deps='''
                 talloc
                 tevent
                 param
                 libsmb
                 popt_samba3
                 PROFILE''',
                 install_path='${SBINDIR}',
                 vars=locals())

bld.SAMBA3_BINARY('winbindd/winbindd',
                 source=WINBINDD_SRC,
                 deps='''
                 talloc
                 tevent
                 pdb
                 popt_samba3
                 idmap
                 ads
                 msrpc3
                 nss_info
                 LIBAFS
                 LIBADS_SERVER
                 LIBCLI_SAMR
                 SLCACHE
                 RPC_NDR_DSSETUP
                 RPC_NDR_WBINT
                 SRV_NDR_WBINT
                 RPC_SAMR
                 RPC_LSARPC
                 RPC_NCACN_NP
                 RPC_PIPE_REGISTER
                 WB_REQTRANS
                 LIBLSA
                 ''',
                 enabled=bld.env.build_winbind,
                 install_path='${SBINDIR}',
                 vars=locals())

bld.SAMBA3_BINARY('web/swat',
                 source=SWAT_SRC,
                 deps='''
                 talloc
                 tevent
                 samba3core
                 libsmb
                 param
                 pdb
                 popt_samba3
                 smbd_base
                 LOCKING
                 PLAINTEXT_AUTH
                 PASSCHANGE
                 PRINTBASE
                 PRINTING
                 ''',
                 enabled=bld.env.build_swat,
                 install_path='${SBINDIR}',
                 vars=locals())

bld.SAMBA3_BINARY('rpcclient/rpcclient',
                 source=RPCCLIENT_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 pdb
                 libsmb
                 param
                 ndr-standard
                 msrpc3
                 SMBREADLINE
                 trusts_util
                 RPC_NDR_WINREG
                 RPC_NDR_ECHO
                 RPC_CLIENT_SCHANNEL
                 DCUTIL
                 LIBCLI_SAMR
                 libcli_lsa3
                 libcli_netlogon3
                 cli_spoolss
                 RPC_NDR_SRVSVC
                 RPC_NDR_WKSSVC
                 RPC_NDR_DSSETUP
                 RPC_NDR_DFS
                 RPC_NDR_DRSUAPI
                 RPC_NDR_NTSVCS
                 RPC_NDR_EVENTLOG
                 INIT_SAMR
		 RPC_NDR_FSRVP
                 ''',
                 vars=locals())

bld.SAMBA3_BINARY('client/smbclient',
                 source=CLIENT_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 param
                 ndr-standard
                 SMBREADLINE
                 libsmb
                 msrpc3
                 RPC_NDR_SRVSVC
                 cli_smb_common''')

bld.SAMBA3_BINARY('net',
                 source=NET_SRC,
                 deps='''
                 talloc
                 netapi
                 addns
                 samba_intl
                 popt_samba3
                 pdb
                 libsmb
                 param
                 KRBCLIENT
                 ndr-standard
                 msrpc3
                 gpo
                 ads
                 smbd_base
                 LIBADS_SERVER
                 LIBADS_PRINTER
                 SMBREADLINE
                 PASSWD_UTIL
                 LIBNET
                 LIBNET_DSSYNC
                 LIBNET_SAMSYNC
                 LIBEVENTLOG
                 REGFIO
                 NDR_NTPRINTING
                 RPC_NDR_WINREG
                 RPC_CLIENT_SCHANNEL
                 LIBCLI_SAMR
                 libcli_lsa3
                 libcli_netlogon3
                 cli_spoolss
                 RPC_NDR_SRVSVC
                 RPC_NDR_SVCCTL
                 RPC_NDR_DSSETUP
                 RPC_NDR_INITSHUTDOWN
                 printing_migrate
                 trusts_util''',
                 vars=locals())

bld.SAMBA3_BINARY('profiles',
                 source=PROFILES_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 param
                 REGFIO''',
                 vars=locals())

bld.SAMBA3_BINARY('smbspool',
                 source=CUPS_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 param
                 libsmb
                 samba3core''',
                 vars=locals())

bld.SAMBA3_BINARY('testparm',
                 source=TESTPARM_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3''',
                 vars=locals())

bld.SAMBA3_BINARY('smbta-util',
                 source=SMBTA_UTIL_SRC,
                 deps='''
                 talloc
                 secrets3
                 param''',
                 vars=locals())

bld.SAMBA3_BINARY('smbstatus',
                 source=STATUS_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3
                 smbd_base
                 LOCKING
                 PROFILE''',
                 vars=locals())

bld.SAMBA3_BINARY('smbcontrol',
                 source=SMBCONTROL_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3
                 PRINTBASE''',
                 vars=locals())

bld.SAMBA3_BINARY('smbtree',
                 source=SMBTREE_SRC,
                 deps='''
                 talloc
                 param
                 libsmb
                 msrpc3
                 popt_samba3
                 PROFILE
                 RPC_NDR_SRVSVC''',
                 vars=locals())

bld.SAMBA3_BINARY('smbpasswd',
                 source=SMBPASSWD_SRC,
                 deps='''
                 talloc
                 param
                 pdb
                 PASSWD_UTIL
                 PASSCHANGE''',
                 vars=locals())

bld.SAMBA3_BINARY('pdbedit',
                 source=PDBEDIT_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3
                 pdb
                 PASSWD_UTIL''',
                 vars=locals())

bld.SAMBA3_BINARY('smbget',
                 source=SMBGET_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 smbclient''',
                 vars=locals())

bld.SAMBA3_BINARY('nmblookup',
                 source=NMBLOOKUP_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3
                 LIBNMB''',
                 vars=locals())

bld.SAMBA3_BINARY('smbtorture' + bld.env.suffix3,
                 source=SMBTORTURE_SRC,
                 deps='''
                 talloc
                 param
                 libsmb
                 msrpc3
                 TLDAP
                 RPC_NDR_ECHO
                 WB_REQTRANS
                 LOCKING
		 NDR_OPEN_FILES
		 idmap
                 ''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('smbconftort',
                 source=SMBCONFTORT_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('replacetort',
                 source='../lib/replace/test/main.c',
                 deps='replace replace-test',
                 install=False)

bld.SAMBA3_BINARY('msgtest',
                 source=MSGTEST_SRC,
                 deps='''
                 talloc
                 param''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('smbcacls',
                 source=SMBCACLS_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 msrpc3
                 libcli_lsa3
                 krb5samba''',
                 vars=locals())

bld.SAMBA3_BINARY('smbcquotas',
                 source=SMBCQUOTAS_SRC,
                 deps='''
                 talloc
                 popt_samba3
                 libsmb
                 msrpc3
                 libcli_lsa3''',
                 vars=locals())

bld.SAMBA3_BINARY('eventlogadm',
                 source=EVTLOGADM_SRC,
                 deps='''
                 talloc
                 param
                 LIBEVENTLOG''',
                 vars=locals())

bld.SAMBA3_BINARY('sharesec',
                 source=SHARESEC_SRC,
                 deps='''
                 talloc
                 popt_samba3''',
                 vars=locals())

bld.SAMBA3_BINARY('pdbtest',
                 source=PDBTEST_SRC,
                 deps='''
                 talloc
                 pdb
                 popt_samba3
                 AUTH_COMMON
                 auth''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('vfstest',
                 source=VFSTEST_SRC,
                 deps='''
                 vfs
                 popt_samba3
                 SMBREADLINE''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('log2pcap',
                 source=LOG2PCAP_SRC,
                 deps='''talloc popt''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('locktest2',
                 source=LOCKTEST2_SRC,
                 deps='''
                 talloc
                 param
                 libsmb
                 LOCKING''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('debug2html',
                 source=DEBUG2HTML_SRC,
                 deps='''talloc popt''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('smbfilter',
                 source=SMBFILTER_SRC,
                 deps='''
                 talloc
                 param
                 LIBNMB''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('versiontest',
                 source='lib/version_test.c',
                 deps='''
                 SAMBA_VERSION
                 param''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('ntlm_auth',
                 source=NTLM_AUTH_SRC,
                 deps='''
                 talloc
                 krb5samba
                 iniparser
                 libsmb
                 popt_samba3
                 LIBNTLMSSP gse gensec''',
                 vars=locals())

bld.SAMBA3_BINARY('timelimit',
                 source='script/tests/timelimit.c',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('rpc_open_tcp',
                 source=RPC_OPEN_TCP_SRC,
                 deps='''
                 talloc
                 msrpc3''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('test_lp_load',
                 source=TEST_LP_LOAD_SRC,
                 deps='''
                 talloc
                 param
                 popt_samba3''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('dbwrap_tool',
                 source=DBWRAP_TOOL_SRC,
                 deps='''
                 talloc
                 popt_samba3''',
                 vars=locals())

bld.SAMBA3_BINARY('dbwrap_torture',
                 source=DBWRAP_TORTURE_SRC,
                 deps='''
                 talloc
                 popt_samba3''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('split_tokens',
                 source=SPLIT_TOKENS_SRC,
                 deps='''
                 talloc
                 popt_samba3''',
                 install=False,
                 vars=locals())

bld.SAMBA3_BINARY('vlp',
                 source=VLP_SRC,
                 deps='''
                 talloc
                 param''',
                 install=False,
                 vars=locals())

bld.SAMBA3_PYTHON('pysmbd',
                  source='smbd/pysmbd.c',
                  deps='smbd_base pyrpc_util',
                  realname='samba/samba3/smbd.so'
                  )

bld.SAMBA3_PYTHON('pylibsmb',
                  source='libsmb/pylibsmb.c',
                  deps='smbclient samba-credentials',
                  realname='samba/samba3/libsmb_samba_internal.so'
                  )

swat_dir = os.path.join(bld.curdir, '../swat')
swat_files = recursive_dirlist(swat_dir, swat_dir, '*')
swat_msg_dir = os.path.join(bld.curdir, 'po')
swat_msg_files = recursive_dirlist(swat_msg_dir, swat_msg_dir, '*.msg')
bld.INSTALL_FILES('${SWATDIR}', swat_files, base_name='../swat')
bld.INSTALL_FILES('${CODEPAGEDIR}', swat_msg_files, base_name='po')

########################## INCLUDES #################################

bld.RECURSE('auth')
bld.RECURSE('libgpo/gpext')
bld.RECURSE('lib/pthreadpool')
bld.RECURSE('lib/asys')
bld.RECURSE('librpc')
bld.RECURSE('librpc/idl')
bld.RECURSE('libsmb')
bld.RECURSE('modules')
bld.RECURSE('pam_smbpass')
bld.RECURSE('passdb')
bld.RECURSE('rpc_server')
bld.RECURSE('script')
bld.RECURSE('winbindd')
bld.RECURSE('../examples/auth')
bld.RECURSE('../examples/libsmbclient')
bld.RECURSE('../examples/pdb')
bld.RECURSE('../examples/VFS')
bld.RECURSE('lib/netapi/tests')
bld.RECURSE('lib/netapi/examples')

bld.ENFORCE_GROUP_ORDERING()
bld.CHECK_PROJECT_RULES()

bld.SYMBOL_CHECK()
